package com.spvs.file.config;

import com.spvs.common.core.web.domain.AjaxResult;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.multipart.MaxUploadSizeExceededException;

/**
 * 文件超出限制异常处理
 * @author QXW
 * @date 2024/6/27 14:57
 */
@ControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(MaxUploadSizeExceededException.class)
    public AjaxResult handleMaxSizeException(MaxUploadSizeExceededException e) {
        return AjaxResult.warn("文件大小不能超出50M");
    }
}
